<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>输血不良事件上报详细表</title>
  <link rel="stylesheet" href="../layui/css/layui.css">
  <script src="../layui/layui.js"></script>
  <style>
    @page {
      width: 1200px ;
    }
    /*打印所用的css*/
    @media print {
      #button_bar {
        display: none;
      }

      #content_wrap {
        width: 1000px !important;
        /*布局的时候，为了给侧边栏留位置，给主体内容加了margin-left，现在需要去掉。*/
        margin-left: 0 !important;
        /*margin-bottom: 0 !important;*/
        /*margin-top: 0 !important;*/
        /*margin-right: 0 !important;*/
      }
    }
  </style>
</head>
<body>
<div class="layui-form-item" id="button_bar" >
  <div class="layui-input-block" style=" margin-top: 20px">
    <button type="button" class="layui-btn"  id = “back” onclick="self.location = document.referrer;">返回</button>
    <button type="button" class="layui-btn"  id="dayin">打印</button>
  </div>
</div>
<form class="layui-form" lay-filter="FormLoad"  id="content_wrap">
  <!--startprint1-->
  <table border="1px" width="100%" cellpadding="0">
    <tr >
      <td colspan="8" style="text-align: center; height: 50px"> <span style=" font-size: 20px">输血不良反应回报单</span> </td>
    </tr>
    <tr>
      <div class="layui-form-item">
        <td colspan="2">
          时间：
        </td>
        <td colspan="6">
          <input type="text" name="report_date" id="report_date" placeholder="" class="layui-input" disabled>
        </td>
      </div>
    </tr>
    <tr>
      <div class="layui-form-item">
        <td colspan="1">
          受血患者姓名：
        </td>
        <td colspan="1">
          <input type="text" name="patient_name" placeholder="" class="layui-input" disabled>
        </td>
        <td colspan="1">
          性别
        </td>
        <td colspan="1">
          <input type="text" name="patient_sex" placeholder="" class="layui-input" disabled>

<!--          <select name="patient_sex" lay-verify="required" disabled>-->
<!--            <option value=""></option>-->
<!--            <option value="男">男</option>-->
<!--            <option value="女">女</option>-->
<!--          </select>-->
        </td>

        <td colspan="1">
          年龄
        </td>
        <td colspan="1">
          <input type="text" name="patient_age" placeholder="" class="layui-input" disabled>
        </td>
        <td colspan="1">
          血型
        </td>
        <td colspan="1">
          <input type="text" name="patient_blood_type" placeholder="" class="layui-input" disabled>
        </td>
      </div>
    </tr>
    <tr>
      <div class="layui-form-item">

        <td>
          住院门诊号：
        </td>
        <td colspan="1">
          <input type="text" name="patient_num" placeholder="" class="layui-input" disabled>
        </td>
        <td colspan="1">
          科别
        </td>
        <td colspan="2">
          <input type="text" name="reporter_department" placeholder="" class="layui-input" disabled>
        </td>
        <td colspan="1">
          床号
        </td>
        <td colspan="2">
          <input type="text" name="patient_bed_num" placeholder="" class="layui-input" disabled>
        </td>
      </div>
    </tr>
    <tr>
      <div class="layui-form-item">

        <td>
          输血史
        </td>
        <td colspan="1">
          <input type="text" name="patient_transfusion_history" placeholder="" class="layui-input" disabled>
<!--          <input type="radio" name="patient_transfusion_history" value="有" title="有" disabled>-->
<!--          <input type="radio" name="patient_transfusion_history" value="无" title="无" disabled>-->
        </td>
        <td colspan="1">
          妊娠史
        </td>
        <td colspan="2">
          <input type="text" name="patient_pregnancy_history" placeholder="" class="layui-input" disabled>
<!--          <input type="radio" name="patient_pregnancy_history" value="孕" title="孕" disabled>-->
<!--          <input type="radio" name="patient_pregnancy_history" value="产" title="产" disabled>-->
<!--          <input type="radio" name="patient_pregnancy_history" value="无" title="无" disabled>-->
        </td>
        <td colspan="3"></td>
      </div>
    </tr>
    <td colspan="8" style="text-align: center; height: 30px"> <span style=" font-size: 12px">临床诊断</span> </td>
    <tr>
      <div class="layui-form-item">

        <td colspan="2">
          输血时患者是否处于全麻状态：
        </td>
        <td colspan="2">
          <input type="text" name="patient_transfusion_status" placeholder="" class="layui-input" disabled>
<!--          <input type="radio" name="patient_transfusion_status" value="是" title="是" disabled>-->
<!--          <input type="radio" name="patient_transfusion_status" value="否" title="否" disabled>-->
        </td>
        <td colspan="2">
          输血不良反应:
        </td>
        <td colspan="2">
          <input type="text" name="patient_transfusion_bad_event" placeholder="" class="layui-input" disabled>
<!--          <input type="radio" name="patient_transfusion_bad_event" value="有" title="有" disabled>-->
<!--          <input type="radio" name="patient_transfusion_bad_event" value="无" title="无" disabled>-->
        </td>
      </div>
    </tr>
    <tr>
      <div class="layui-form-item">
        <td rowspan="2">
          输入血液：
        </td>

        <td colspan="1">
          血型：
        </td>
        <td colspan="2">
          <input type="text" name="patient_transfusion_blood_type" placeholder="" class="layui-input" disabled>
        </td>
        <td colspan="2"> 血肿：</td>
        <td colspan="2">
          <input type="text" name="patient_transfusion_blood_kind" placeholder="" class="layui-input" disabled>
        </td>
      </div>
    </tr>
    <tr>
      <div class="layui-form-item">

        <td colspan="1">
          输入量：
        </td>
        <td colspan="2">
          <input type="text" name="patient_transfusion_blood_amount" placeholder="" class="layui-input" disabled>
        </td>
        <td colspan="2"> 血袋信息码：</td>
        <td colspan="2">
          <input type="text" name="patient_transfusion_blood_num" placeholder="" class="layui-input" disabled>
        </td>
      </div>
    </tr>
    <tr>
      <div class="layui-form-item">
        <td colspan="1">
          献血者与受害者的关系：
        </td>
        <td colspan="7">
          <input type="text" name="volunteer_relation_patient" placeholder="" class="layui-input" disabled>
<!--          <input type="radio" name="volunteer_relation_patient" value="一级亲属关系" title="一级亲属关系" disabled>-->
<!--          <input type="radio" name="volunteer_relation_patient" value="二级亲属关系" title="二级亲属关系" disabled>-->
<!--          <input type="radio" name="volunteer_relation_patient" value="无亲属关系" title="无亲属关系" disabled>-->
        </td>
      </div>
    </tr>
    <tr>
      <div class="layui-form-item">
        <td rowspan="4">
          输血不良反应情况
        </td>
        <td>
          发生时间：
        </td>
        <td colspan="3">
          <input type="text" name="patient_transfusion_happen_time" placeholder="" class="layui-input" disabled>
<!--          <input type="radio" name="patient_transfusion_happen_time" value="输血前" title="输血前" disabled>-->
<!--          <input type="radio" name="patient_transfusion_happen_time" value="输血后" title="输血后" disabled>-->
        </td>
        <td colspan="1">
          转归：
        </td>
        <td colspan="2">
          <input type="text" name="patient_transfusion_class" placeholder="" class="layui-input" disabled>
<!--          <input type="radio" name="patient_transfusion_class" value="治愈" title="治愈" disabled>-->
<!--          <input type="radio" name="patient_transfusion_class" value="死亡" title="死亡" disabled>-->
        </td>
      </div>
    </tr>
    <tr>
      <div class="layui-form-item">

        <td>
          症状与体征：
        </td>
        <td colspan="6">
          <input type="text" name="patient_transfusion_symptom" placeholder="" class="layui-input" disabled>
          <!--          <input type="checkbox" name="patient_transfusion_symptom" title="发热" value="发热" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="发组" value="发组" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="腰背痛" value="腰背痛" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="呼吸困难" value="呼吸困难" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="两肺布满湿性落音" value="两肺布满湿性落音" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="黄痘" value="黄痘" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="寒战" value="寒战" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="荨麻疹" value="荨麻疹" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="酱油性尿" value="酱油性尿" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="咳大量血性泡沫样痰" value="咳大量血性泡沫样痰" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="休克" value="休克" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="皮肤充血" value="皮肤充血" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="劲静脉怒张" value="劲静脉怒张" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="伤口渗血不止" value="伤口渗血不止" lay-skin="primary" disabled>-->
<!--          <input type="checkbox" name="patient_transfusion_symptom" title="其他" value="其他" lay-skin="primary" disabled>-->
        </td>
      </div>
    </tr>
    <tr>
      <div class="layui-form-item">
        <td colspan="1">
          临床科室处理措施
        </td>
        <td colspan="6">
          <textarea name="clinical_dept_deal" style="height: 50px" required lay-verify="required" placeholder="请输入" class="layui-textarea" disabled></textarea>
        </td>
      </div>
    </tr>
    <tr>
      <div class="layui-form-item">
        <td colspan="1">
          诊断：
        </td>
        <td colspan="6">
          <input type="text" name="bad_event_diagnose" placeholder="" class="layui-input" disabled>
<!--          <input type="radio" name="bad_event_diagnose" value="发热反应" title="发热反应" disabled>-->
<!--          <input type="radio" name="bad_event_diagnose" value="过敏反应" title="过敏反应" disabled>-->
<!--          <input type="radio" name="bad_event_diagnose" value="急性溶血反应" title="急性溶血反应" disabled>-->
<!--          <input type="radio" name="bad_event_diagnose" value="其他" title="其他" disabled>-->
        </td>
      </div>
    </tr>
    <tr>
      <div class="layui-form-item">
        <td colspan="1">
          签名
        </td>
        <td colspan="1">
          护士
        </td>
        <td colspan="2">
          <input type="text" name="nurse_sign" placeholder="" class="layui-input" disabled>
        </td>
        <td colspan="1">
          经治医师：
        </td>
        <td colspan="1">
          <input type="text" name="treat_doctor_sign" placeholder="" class="layui-input" disabled>
        </td>
        <td colspan="1">
          临床科主任：
        </td>
        <td colspan="1">
          <input type="text" name="clinical_dept_header_sign" placeholder="" class="layui-input" disabled>
        </td>
      </div>
    </tr>
    <tr>
      <td colspan="3">
        输血科主任或负责人：
      </td>
      <td colspan="5">
        <input type="text" name="transfusion_dept_header_sign" placeholder="" class="layui-input" disabled>
      </td>
    </tr>
    <tr>        <td colspan="8">
      <span>备注：</span>
      <ol>
        <li>①输血不良反应回报登记制度是全面血液质量管理的一项重要内容，是输血反应跟踪调查信息统计的重要依据；</li>
        <li>②输血期间或输血后，若患者出现输血不良反应，临床科室应及时通知输血科，并及时填写此回报单报送输血科。</li>
      </ol>
    </td>       </tr>

  </table>
  <!--endprint1-->
</form>
</body>

<script>

  let str;
  layui.use(['laydate','jquery','form','layedit','layer','table','laytpl'], function() {
    let $ = layui.jquery;
    let form = layui.form;
    let laydate = layui.laydate;
    var layer = layui.layer;
    var router = layui.router();
    laydate.render({
      elem: '#reporter_know_time' //指定元素
      , type: 'date'
    });
    laydate.render({
      elem: '#event_happen_time' //指定元素
      , type: 'date'
    });
    // 打印固定地方
    function preview(oper) {
      if (oper < 10){
        var bdhtml=window.document.body.innerHTML;//获取当前页的html代码
        var sprnstr="<!--startprint"+oper+"-->";//设置打印开始区域
        var eprnstr="<!--endprint"+oper+"-->";//设置打印结束区域
        var prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+18); //从开始代码向后取html

        prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));//从结束代码向前取html
        window.document.body.innerHTML=prnhtml;
        window.print();
        window.document.body.innerHTML=bdhtml;

      }
      else{
        window.print();
      }

    }
//获取打印按钮
    $("#dayin").click(function() {
      onclick=preview(1);
    })


    function getQueryVariable(variable)
    {
      let query = window.location.search.substring(1);
      let vars = query.split("&");
      for (let i=0;i<vars.length;i++) {
        let pair = vars[i].split("=");
        if(pair[0] == variable){return pair[1];}
      }
      return(false);
    }

    form.render();
    // 获取地址的中的值
    let form_code=getQueryVariable("form_code");
    console.log(form_code);
    $.ajax({
      url: '/look?form_code=' + form_code,
      type: 'get',
      success: function (data) {
        console.log(data);
        let jsonObj = eval('(' + data + ')'); //获得jsonObj对象
        console.log(jsonObj);
        //渲染 上报人和上报人单位
        //let json = {};
        for(let i = 0; i<jsonObj.data.length; i++) {
          //给input 框 赋值
          $('input[name= '+ jsonObj.data[i].property_en_name +']').attr("value",jsonObj.data[i].detailed_data);
          // 给 textarea赋值
          $('textarea[name= '+ jsonObj.data[i].property_en_name +']').text(jsonObj.data[i].detailed_data);
        }
        //form.val("FormLoad",json)
      }
    });

  })
</script>

</html>